Euler Problem 52

It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.

Find the smallest positive integer, $x$, such that $2x$, $3x$, $4x$, $5x$, and $6x$, contain the same digits.


In [1]:
from itertools import count
for x in count(1):
    digits = sorted(str(x))
    if all(sorted(str(k*x)) == digits for k in [2,3,4,5,6]):
        print(x)
        break
    x += 1


142857

In [ ]: